package com.javaweb.controller;

import com.javaweb.Response.ResponseResult;
import com.javaweb.model.Category;
import com.javaweb.model.Tag;
import com.javaweb.service.CategoryService;
import com.javaweb.service.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/blog-api/v0.1/catrgory")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;
    @PostMapping("/add")
    public ResponseResult<Object> add(Category category){
        categoryService.add(category);
        return ResponseResult.ok(null,"新增成功");
    }
    @DeleteMapping("/delete")
    public ResponseResult<Object> delete(Category category){
        categoryService.add(category);
        return ResponseResult.ok(null,"删除成功");
    }
    @GetMapping("/list")
    public ResponseResult<List<Category>> list(){
        return ResponseResult.ok(categoryService.list(),"查询所有成功");
    }
}
